Imports DotNetPM.Business.Questionnaire
Imports System.Collections.Generic
Imports System.Data

Partial Class Modules_Questionnaires_QuestionPreview
    Inherits baseWebPage

    Private _cView As Integer = -1

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        hlBack.NavigateUrl = GetPreviousPage()
        If Not IsPostBack Then
            Dim questionId As String = Request.QueryString("qid")
            If Not String.IsNullOrEmpty(questionId) Then
                Dim _question As Question = QuestionODS.GetQuestion(CInt(questionId))
                'Throw New Exception(_question.ID & "|" & _question.Question & "|" & _question.Configuration)
                Dim dt As New DataTable
                dt.Columns.Add("SortID")
                dt.Columns.Add("ID")
                dt.Columns.Add("Question")
                dt.Columns.Add("Config")
                For i As Integer = 0 To 0
                    Dim dr As DataRow = dt.NewRow
                    dr("SortID") = i
                    dr("ID") = _question.ID
                    dr("Question") = _question.Question
                    dr("Config") = _question.Configuration
                    dt.Rows.Add(dr)
                Next
                repQuestionnaire.DataSource = dt
                repQuestionnaire.DataBind()
            End If
        End If
    End Sub


#Region "Test Button Click"

    Private ucs As New List(Of ASP.secure_controls_ansloader_ascx)

    Protected Sub repQuestionnaire_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles repQuestionnaire.ItemCommand
        Select Case e.CommandName
            Case "cmdTest"
                lblTest.Visible = True
            Case "cmdBack"
                Response.Redirect(MyBase.GetPreviousPage)
        End Select
    End Sub

    Protected Sub repQuestionnaire_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles repQuestionnaire.ItemCreated
        Dim uc As ASP.secure_controls_ansloader_ascx = e.Item.FindControl("ucAnswer")
        If Not uc Is Nothing Then
            ucs.Add(uc)
        End If
    End Sub
#End Region

End Class
